package com.trivia.restServices

import com.trivia.restResponses.RestResponseUtil;

abstract class  AbstractController {

    protected def response

    def execute() {
        try{
            executeTry()
        }catch(RuntimeException e){
            log.error(e.getMessage())
            executeCatch()
        }finally{
            log.info("Sendig the response......")
            log.info(response.toXML())
            this.request.setCharacterEncoding
            render response.toXML()
        }
    }

    def executeCatch(){
        response = RestResponseUtil.getErrorResponse()
    }

    def abstract executeTry()
  
}

